package com.example.demo

import com.example.demo.model.Clazz
import com.example.demo.model.Student
import com.example.demo.repository.StudentRepository
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ContextConfiguration
import spock.lang.Specification

/**
 * @title: StudentServiceImplSpec* @projectName demo* @description: empty* @author lafengmaker* @email ywjwy365@126.com
 * @date 2019-10-10 09:44
 */
//@ContextConfiguration(classes = DemoApplication.class)
@SpringBootTest
class StudentServiceImplSpec extends Specification {
    @Autowired
    StudentRepository studentRepository;

    def "AddStudent"() {
        given:
         when:
        Student student=new Student();
        student.setName("李四1");
        student.setAge(18);
        student.setSex(1);
        Clazz clazz=new Clazz();
        //clazz.setId(2);
        clazz.setName("初二");
        student.setClazz(clazz);
        studentRepository.save(student);
        then:
        1==1

    }
}
